<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRegionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('region', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('pid')->nullable()->comment('父级ID');
            $table->string('shortname', '100')->nullable()->comment('简称');
            $table->string('name', '100')->nullable()->comment('名称');
            $table->string('merger_name', '255')->nullable()->comment('全称');
            $table->tinyInteger('level')->unsigned()->default(0)->comment('等级');
            $table->string('pinyin', '100')->nullable()->comment('拼音');
            $table->string('code', '100')->nullable()->comment('长途区号');
            $table->string('zip_code', '100')->nullable()->comment('邮编');
            $table->string('first', '50')->nullable()->comment('首字母');
            $table->string('lng', '100')->nullable()->comment('经度');
            $table->string('lat', '100')->nullable()->comment('纬度');
            $table->index('name');
        });
        \DB::statement("ALTER TABLE `region` comment '地区表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('region');
    }
}
